﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TeacherAppraiser.Properties;

namespace TeacherAppraiser
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            tbGetUrl.Text = Resources.TxtDefaultUrl;
        }

        private void btnEnterSys_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbGetUrl.Text))
            {
                MessageBox.Show(
                    "Σ( ° △ °|||)︴\n地址栏不能为空！",
                    "地址栏错误",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                tbGetUrl.Text = Resources.TxtDefaultUrl;
                return;
            }

            if (string.IsNullOrEmpty(tbStuID.Text))
            {
                MessageBox.Show(
                    "(///▽///)\n学号不能为空！",
                    "学号不能为空",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                return;
            }

            if(string.IsNullOrEmpty(tbPW.Text))
            {
                MessageBox.Show(
                    "(￣ε(#￣)\n密码不能为空！",
                    "密码不能为空",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                return;
            }

            var formAppraiser = new Browser
            {
                UrlValue = tbGetUrl.Text,
                StuId = tbStuID.Text,
                StuPw = tbPW.Text
            };
            formAppraiser.Show();
        }

        private void btnReset_Click(object sender, EventArgs e)
        {
            tbGetUrl.Text = Resources.TxtDefaultUrl;
            tbStuID.Text = string.Empty;
            tbPW.Text = string.Empty;
        }

        private void btnAbout_Click(object sender, EventArgs e)
        {
            var formAbout = new About();
            formAbout.Show();
        }
    }
}
